package hk.com.fwd.web.controller;

import hk.com.fwd.biz.exception.DmsException;
import hk.com.fwd.entity.UserGroupFunction;
import hk.com.fwd.fmk.model.AccessRight;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class OriginalController extends BaseController {


    private String functionID = "FUNCTIONID";

    @RequestMapping(value="/PAGEDIR/PAGENAME", method = RequestMethod.GET)
    public String originalInit(ModelMap model) throws DmsException{
        if(AccessRight.NONE == this.checkAccessRight(functionID)) {
            return "unauthorized";
        }
        model.addAttribute("functionPath", this.getFunctionPath(functionID));
        model.addAttribute("functionName", this.getModule(functionID));
        model.addAttribute("username", this.getUsername());
        model.addAttribute("accessRight", this.getFuncIndRW(new UserGroupFunction(functionID,"DMS",this.getUsername())));
        return "/PAGEDIR/PAGENAME";
    }

}
